package com.ytjj.qmyx.admin.controller.imController;


import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.ImCustomerLabel;
import com.ytjj.qmyx.admin.model.vo.ImCustomerLabelVO;
import com.ytjj.qmyx.admin.service.imService.ImCustomerLabelService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 客户标签管理controller
 */
@RestController
@RequestMapping("/imLabel")
@Slf4j
public class ImCustomerLabelController {

    @Autowired
    private ImCustomerLabelService imCustomerLabelService;

    /**
     * 新增标签
     * 参数: "labelName"
     *       "labelColour"
     *
     */
    @PostMapping("/insertLabel")
    public CommonResult insertLabel(@RequestBody ImCustomerLabel imCustomerLabel){
        return CommonResult.success(imCustomerLabelService.insertLabel(imCustomerLabel));
    }
    /**
     * 删除标签
     * 参数: id
     * @return
     */
    @PostMapping("/deleteLabel")
    public CommonResult deleteLabel(@RequestBody ImCustomerLabelVO imCustomerLabelVO){
        return CommonResult.success(imCustomerLabelService.deleteLabel(imCustomerLabelVO));
    }
    /**
     * 修改标签
     * 参数:labelName  labelColour
     * @return
     */
    @PostMapping("/updateLabel")
    public CommonResult updateLabel(@RequestBody ImCustomerLabelVO imCustomerLabelVO){
        return CommonResult.success(imCustomerLabelService.updateLabel(imCustomerLabelVO));
    }
    /**
     * 查询所有标签(分页)
     * 参数: id:空
     * @return
     */
    @PostMapping("/selectAllLabel")
    public CommonResult selectAllLabel(@RequestBody ImCustomerLabelVO imCustomerLabelVO){
        return CommonResult.success(imCustomerLabelService.selectLabel(imCustomerLabelVO));
    }

    /**
     * 查询所有标签
     * @param
     * @return
     */
    @GetMapping("/queryLabel")
    public CommonResult selectLabel(){
        return CommonResult.success(imCustomerLabelService.queryLabel());
    }
}
